﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CafeOnline.Common;
using CafeOnline.Domain.Entities;
using CafeOnline.Domain.IRepositories;
using CafeOnline.Domain.Repository;
using CafeOnline.MvcFramework.Composition;
using CafeOnline.MvcFramework.Grid;

namespace CafeOnline.Controllers {
    [Export(typeof(IController)), ExportMetadata("Name", ControllerNames.GRID)]
    public class GridController : BaseController {
#pragma warning disable 0649,0169
        [Import]
        private GridProvider m_gridProvider;
       
#pragma warning restore 0649,0169
        [HttpGet]
        public ActionResult GetData(string gridType,string gridId,GridSettings settings) {
            
            return Json(m_gridProvider.GetGridFactory(gridType).SearchData(gridId, settings), JsonRequestBehavior.AllowGet);
        }
    }
}